package com.ruoyi.system.service.impl;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import cn.hutool.core.date.DateUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.vo.OrderStatisticsRes;
import com.ruoyi.system.vo.req.SysOrderReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysUserBillcashMapper;
import com.ruoyi.system.domain.SysUserBillcash;
import com.ruoyi.system.service.ISysUserBillcashService;
import com.ruoyi.common.core.text.Convert;

/**
 * 用户资金流水记录Service业务层处理
 *
 * @author Ericcc
 * @date 2021-03-11
 */
@Service
public class SysUserBillcashServiceImpl implements ISysUserBillcashService
{
    @Autowired
    private SysUserBillcashMapper sysUserBillcashMapper;

    /**
     * 查询用户资金流水记录
     *
     * @param billcashId 用户资金流水记录ID
     * @return 用户资金流水记录
     */
    @Override
    public SysUserBillcash selectSysUserBillcashById(Long billcashId)
    {
        return sysUserBillcashMapper.selectSysUserBillcashById(billcashId);
    }

    /**
     * 查询用户资金流水记录列表
     *
     * @param sysUserBillcash 用户资金流水记录
     * @return 用户资金流水记录
     */
    @Override
    public List<SysUserBillcash> selectSysUserBillcashList(SysUserBillcash sysUserBillcash)
    {
        return sysUserBillcashMapper.selectSysUserBillcashList(sysUserBillcash);
    }

    /**
     * 新增用户资金流水记录
     *
     * @param sysUserBillcash 用户资金流水记录
     * @return 结果
     */
    @Override
    public int insertSysUserBillcash(SysUserBillcash sysUserBillcash)
    {
        sysUserBillcash.setCreateTime(DateUtils.getNowDate());
        return sysUserBillcashMapper.insertSysUserBillcash(sysUserBillcash);
    }

    /**
     * 修改用户资金流水记录
     *
     * @param sysUserBillcash 用户资金流水记录
     * @return 结果
     */
    @Override
    public int updateSysUserBillcash(SysUserBillcash sysUserBillcash)
    {
        sysUserBillcash.setUpdateTime(DateUtils.getNowDate());
        return sysUserBillcashMapper.updateSysUserBillcash(sysUserBillcash);
    }

    /**
     * 删除用户资金流水记录对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysUserBillcashByIds(String ids)
    {
        return sysUserBillcashMapper.deleteSysUserBillcashByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户资金流水记录信息
     *
     * @param billcashId 用户资金流水记录ID
     * @return 结果
     */
    @Override
    public int deleteSysUserBillcashById(Long billcashId)
    {
        return sysUserBillcashMapper.deleteSysUserBillcashById(billcashId);
    }

    @Override
    public BigDecimal selectSysUserBillcashStatistics(SysOrderReq sysOrder, Date beginTime) {
        sysOrder.setBeginDate(beginTime);
        return sysUserBillcashMapper.selectSysUserBillcashStatistics(sysOrder);
    }

    @Override
    public BigDecimal selectSysAgentBillcashStatistics(SysOrderReq sysOrder, Date beginTime) {
        sysOrder.setBeginDate(beginTime);
        return sysUserBillcashMapper.selectSysUserBillcashStatistics(sysOrder);
    }

    @Override
    public List<SysUserBillcash> selectSysAgentUserBillcashList(SysUserBillcash sysUserBillcash) {
        return sysUserBillcashMapper.selectSysAgentUserBillcashList(sysUserBillcash);
    }

    @Override
    public List<SysUserBillcash> selectSysHighAgentUserBillcashList(SysUserBillcash sysUserBillcash) {
        return sysUserBillcashMapper.selectSysHighAgentUserBillcashList(sysUserBillcash);
    }
}
